
//
// 101121 - AH - Created.
// 101122a- AH - Fixed that getAttributeName() was not final.
// 101122b- AH - Missing java doc.
//

package org.soekrat.engine.io;

/**
 * <p>
 *   Base class for objects managed by a
 *   {@link AttributeValuesToString} object to convert a
 *   {@link #getAttributeName() named} attribute's value to 
 *   {@code String} presentation.
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC) 
 */
public abstract class AttributeValueToString 
{
  private final String m_attrName;
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param attrName Name on attribute {@code this} write 
   *                 {@code String} representation for.
   */
  protected AttributeValueToString(String attrName)
  {
    if (attrName==null)
    {
      throw new NullPointerException("attrName");
    }
    
    m_attrName=attrName;
  }
  
  /**
   * <p>
   *   Gets name on attribute {@code this} write {@code String} representation 
   *   for.
   * </p>
   * @return Name.
   */
  public final String getAttributeName(){ return m_attrName; }
  
  /**
   * <p>
   *   Gets
   *   {@link String} representation of attribute value.
   * </p>
   * @param value Value.
   * @return {@link String} representation.
   */
  public abstract String toString(Object value);
  
}
